#ifndef MAGIC_HAT_H_
#define MAGIC_HAT_H_


typedef struct MagicHat* MagicHat;

typedef enum {
		MAGICHAT_SUCCESS,
		MAGICHAT_NULL_ARGUMENT,
} MagicHatResult;

typedef void* Element;
typedef int Seed;

/**
 * the function that will generate and return a new number between min to max
 * using the given seed
 */
typedef int (*RandomNumber) (Seed seed,int min, int max);

/**
 * initiating a new hat
 * @param randomNumber - the randomNumber function
 * @param seed - the seed sent to the funcion
 * @param elementCopy - the function to copy an element
 * @param elementDestroy - the function to destroy an element
 * @param elementCompare - the fucntion to compare hat elements and check if
 * found in it.
 * return: the newly created hat
 * 		NULL if memory alocation failed
 */
magicHat hatCreate(RandomNumber randomNumber, Seed seed,
		Element (*elementCopy)(Element), void (*ElementDestroy)(Element),
		int (*elementCompare) (Element,Element));
/**
 * the function to destroy the hat with, and free all memory allocations
 */
void hatDestroy(MagicHat hat);

/**
 * pushing an element into the hat in n copies
 * @param hat - the hat to push into
 * @param element - the element to push in
 * @param amount - the number of copies to push in
 * return: MAGICHAT_SUCCESS - if succeeded
 * 		MAGICHAT_NULL - if failed
 */
MagicHatResult hatInsert(MagicHat hat, Element element, int amount);

/**
 * pulling an element out of the hat. one copy of the element will be removed
 * from the hat after the action.
 * @param hat - the hat to pull from
 * return: the random element from the hat
 * 	NULL if the hat is empty
 */
Element hatPull(MagicHat hat);


#endif /* MAGIC_HAT_H_ */
